﻿using MapDownloader.Core.Models;
using System;
using System.Collections.Generic;
using System.Text;

namespace MapDownloader.Core.Storage
{
    /// <summary>
    /// 存储接口
    /// </summary>
    public interface ITileStore
    {
        /// <summary>
        /// 存入数据库
        /// </summary>
        /// <param name="type">瓦片类型</param>
        /// <param name="pos">坐标</param>
        /// <param name="tile">瓦片的内容</param>
        /// <returns></returns>
        bool PutTileToStore(int type,TilePoint pos,byte[] tile);
      
      /// <summary>
      /// 从数据库获取瓦片
      /// </summary>
      /// <param name="x"></param>
      /// <param name="y"></param>
      /// <param name="zoom"></param>
      /// <param name="type">瓦片类型</param>
      /// <returns></returns>
      BaseImage GetTileFromStore( long x,long y, int zoom,int type);

      /// <summary>
      /// 删除某一个日期之前的所有瓦片
      /// </summary>
      /// <param name="date">日期.</param>
      /// <param name="type">地图类型</param>
      /// <returns>被删除的瓦片数量</returns>
      int DeleteOlderThan(DateTime date, int? type);
      /// <summary>
      /// 设置连接字符串
      /// </summary>
      /// <param name="con"></param>
      /// <param name="databaseName"></param>
       void SetConnectionString(string con,string databaseName);
    }
}
